const mysql = require('../db/mysql57');

const loginDao = {
    login(account, password) {
        let sql = `select
                u.id as id,
                u.userTypeId as userTypeId,
                ut.name as userType,
                u.name as name,
                u.phone as phone
            from (select id, userTypeId, name, phone from User where account = ? and password = ? and is_del = ? LIMIT 1) as u
            left join UserType as ut on u.userTypeId = ut.id`;
        let data = [ account, password, 'false' ];
        return mysql.sqlExec(sql, data);
    }
};

module.exports = loginDao;